package org.bpms.controller.admin;

import org.bpms.interceptor.WebInterceptor;
import org.bpms.model.wechat.Weixin;
import org.bpms.plugins.bjui.BjuiRender;
import org.bpms.service.wechat.WeixinService;

import com.jfinal.aop.Clear;
import com.jfinal.aop.Enhancer;
import com.jfinal.core.Controller;
/**
 * 微信控制器
 * @author hupei
 *
 */
@Clear(WebInterceptor.class)
public class WeixinController extends Controller{
	private WeixinService weixinService = Enhancer.enhance(WeixinService.class);
	
	/**
	 * 查看微信基本信息
	 */
	public void index(){
		Weixin weixin = weixinService.find();
		setAttr("weixin", weixin);
		render("/admin/weixin/info.html");
	}
	
	/**
	 * 保存微信信息
	 */
	public void save(){
		Weixin weixin = getModel(Weixin.class);
		if (null != weixin)
			weixinService.saveOrUpdate(weixin);
		render(BjuiRender.success("保存成功", false));
	}
}
